package com.blue.waffle.iwc.ui;

import java.util.List;

import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.ui.Image;

public class Letter extends Image
{
    private boolean isSelected;
	private Vector2 originalPosition;    
    private int frameIndex;
    private char letter;
    private int filledBlankIndex;
    
	public Letter(float x, float y, TextureRegion region, int frameIndex, char letter)
    {
		super(region);
    	this.setPosition(x, y);
    	originalPosition = new Vector2(x,y);
    	this.frameIndex = frameIndex;
    	this.setLetter(letter);
    	this.setFilledBlankIndex(-1);
    }
	
	public static void reset(List<Letter> letters){
		if (letters!=null) {
			for (Letter letter : letters) {
				letter.setFilledBlankIndex(-1);
				letter.setPosition(letter.originalPosition.x, letter.originalPosition.y);
			}
		}
	}
	
    public Vector2 getOriginalPosition() {
		return originalPosition;
	}
    
    public int getFrameIndex() {
    	return frameIndex;
    }
    
    public boolean isSelected() {
		return isSelected;
	}

	public void setSelected(boolean isSelected) {
		this.isSelected = isSelected;
	}

	public char getLetter() {
		return letter;
	}

	public void setLetter(char letter) {
		this.letter = letter;
	}

	public int getFilledBlankIndex() {
		return filledBlankIndex;
	}

	public void setFilledBlankIndex(int filledBlankIndex) {
		this.filledBlankIndex = filledBlankIndex;
	}
}